package com.mxpio.erp.common.quality.entity;

import com.mxpioframework.jpa.annotation.DictAble;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import com.mxpioframework.security.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "V_MB_ERP_INSPECTION_BILL_UNQUALIFIED_PARTS")
@Schema(description="采购件不合格占比")
public class VEInspectionBillUnqualifiedParts implements DictAble, Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Generator
    @Column(name = "ID_", updatable = false)
    @Schema(description = "ID")
    private String id;

    @Schema(description = "申请时间（年）")
    @Column(name = "YEAR_")
    private String year;

    @Schema(description = "申请时间（年月）")
    @Column(name = "YEAR_MONTH_")
    private String yearMonth;

    @Column(name = "UNQUALIFIED_TYPE_")
    @Schema(description = "不合格原因类型")
    @Dict(dicCode = "ERP_QUAL_UNQUALIFIED_TYPE")
    private String unqualifiedType;

    @Column(name = "UNQUALIFIED_QUANTITY_")
    @Schema(description = "不合格数量")
    private BigDecimal unqualifiedQuantity;


    @Transient
//    @Column(name = "LAST_MONTH_")
    @Schema(description = "上月占比")
    private BigDecimal lastMonth;

    @Transient
//    @Column(name = "LAST_YEAR_")
    @Schema(description = "累计占比")//按年统计
    private BigDecimal lastYear;

    @Transient
    private Map<String, String> textMap;
    public String putText(String key, String value) {
        if (textMap == null) {
            textMap = new HashMap<>();
        }
        return textMap.put(key, value);
    }
}
